import component from './component.vue';
import XUE from '@/XUE';
import Style from '../configView/Style.vue';
import icon from '@/assets/image/multiline.png';

XUE.registerComponent('形状', component, {
    name: 'x-bezier-close',
    icon,
    label: '线条',
    getConfig() {
        return {
            name: 'x-bezier-close',
            style: {
                left: 0,
                top: 0,
                width: 512,
                height: 288,
            },
            data: {
                strokeWidth: 2,
                stroke: '#A3A3A3',
                locked: true,
                editable: false,
                points: [],
                lineCap: 'butt',
                dasharray: [0, 0],

            },
            events: {
                ok(points) {
                    this.$emit('change', [{
                        path: 'data.points',
                        value: points,
                    }, {
                        path: 'data.locked',
                        value: true,
                    }, {
                        path: 'data.editable',
                        value: true,
                    }]);
                },
                doEditable(data) {
                    const { editable, locked } = data;
                    this.$emit('change', [{
                        path: 'data.editable',
                        value: editable,
                    }, {
                        path: 'data.locked',
                        value: locked,
                    }])
                }
            }
        }
    },
    getConfigView() {
        return [{
            title: '样式',
            view: Style,
        }];
    }
})